package ch.headshot.photomap.client.editor.view;

import ch.headshot.photomap.client.gpx.Gpx;

import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.TextArea;

public class GpxViewer extends DialogBox {

	private static GpxViewer instance;
	private TextArea textArea;

	private GpxViewer() {
		super(true);
		setText("GPX");
		setWidget(getTextArea());
	}

	private TextArea getTextArea() {
		if (textArea == null) {
			textArea = new TextArea();
			textArea.setHeight("500px");
			textArea.setWidth("600px");
		}

		return textArea;
	}

	public void show(Gpx gpx) {
		getTextArea().setText(gpx.toString());
		super.show();
	}

	public static GpxViewer getInstance() {
		if (instance == null) {
			instance = new GpxViewer();
		}
		return instance;
	}

}
